#ifndef PORT_H
#define PORT_H

#include <QString>
#include <QList>
#include <QSharedPointer>

#include  "qkeymetro.h"

class Buffer;

class Port
{
public:
    Port(bool isOut, int nChannels, QString name = QString(""));

    int getNChannels();
    bool isOut();
    void join(Port & portToConnect);

    QSharedPointer <Buffer> & getBuffer(int channelNo);
    void setBuffer(QSharedPointer <Buffer>, int channelNo); // assign a databuffer when the port is not connected, but needs data

    const QString & getName();
    void setName(QString & name);


private:
    //explicitly disable coping
    Port(Port & p);
    Port & operator=(const Port & p);

    QString name_;
    bool isOut_;
    QList < QSharedPointer <Buffer> > buffers_;
};

#endif // PORT_H
